#include"Comm.hpp"
using namespace std;
int main()
{
    key_t key = getkey();
    printf("server key : 0x%x\n", key);
    int shmid = Getshm(key);
    printf("server shmid : %d\n",shmid);
    char* start = (char*)attach(shmid);

    //运行
    sleep(3);
    int cnt = 0;
    char buffer[1024];
    const char* massage = "我是client,我在给你发信息";
    pid_t pid = getpid();
    while (1)
    {
        sleep(1);
       snprintf(start,MAX_SIZE,"%s:这是第%d条信息，我的pid 是 ：%d\n",massage,cnt++,pid);
    }
    //去链接
    dettach(start);
    return 0;
}